<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <!-- basic styles -->
        <link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="../assets/css/font-awesome.min.css" />
        <link rel="stylesheet" href="../assets/css/ace.min.css" />
        <link rel="stylesheet" href="../assets/css/ace-rtl.min.css" />
        <link rel="stylesheet" href="../assets/css/ace-skins.min.css" />
        <style>
            .search_bar{
                padding-bottom: 5px;
                width:100%;
                margin: 0px;
            }
            .search_bar div{
                float: left;
                margin-left: 10px;
                margin-top: 5px;
            }
            .search_bar div strong{
                font-weight: lighter;
                padding-right: 3px;
            }
            .search_bar div input{
                width:160px;
            }
            .search_bar div select{
                width:160px;
            }
            .search{
                border-width:4px;
            }
            .centen{text-align: center}
            .dialog_textarea{
                width: 98%;
                height:150px;
                padding: 1%;
            }
        </style>
    </head>
    <body>
        <div class="main-container">
            <div class="col-xs-12">
                <h3 class="header smaller lighter blue">UD系统日志</h3>
                <div class="row search_bar">
                    <!--起始时间:-->
                    <div>
                        <strong>设备部署IP地址:</strong>
                        <input type="text" id="local_ip" />
                    </div>
                    <!--结束时间:-->
                    <div>
                        <strong>sftp账号:</strong>
                        <input type="text" id="local_user" />
                    </div>     
                    <!--查&nbsp;询-->
                    <div>
                        <button class="btn btn-success btn-xs search" onclick="search()">查&nbsp;询</button>
                    </div>
                </div>
                <div class="table-header">
                    日志查看
                </div>
                <div class="table-responsive">
                    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>设备IP</th>
                                <th>sftp账号</th>
                                <th>上报数据类型</th>
                                <th>上报文件数量</th>
                                <th>上报时间</th>
                            </tr>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <script src="../assets/js/jquery.js"></script>
        <script src="../assets/js/bootstrap.min.js"></script>
        <!-- page specific plugin scripts -->
        <script src="../assets/js/jquery-ui-1.10.3.custom.min.js"></script>
        <script src="../assets/js/jquery.dataTables.min.js"></script>
        <script src="../assets/js/jquery.dataTables.bootstrap.js"></script>
        <script type="text/javascript">
                            $(function() {
                                showTable([]);
                            })
                            function search() {
                                var local_ip = $("#local_ip").val();
                                var local_user = $("#local_user").val();
                                $.ajax({
                                    type: "POST",
                                    async: false,
                                    url: "../action/TdLogQuery.do",
                                    data: {local_ip: local_ip, local_user: local_user},
                                    dataType: "json",
                                    success: function(data) {
                                        showTable(data);
                                    }
                                });
                            }
                            var oTable1;
                            function showTable(souData) {
                                var aaData = [];
                                for (var i in souData) {
                                    var ip = souData[i].ip;
                                    var user = souData[i].user;
                                    var type = souData[i].type;
                                    var files = souData[i].files;
                                    var time = souData[i].time;
                                    aaData.push([ip, user, type, files, time]);
                                }
                                if (oTable1) {
                                    oTable1.fnDestroy();
                                }
                                oTable1 = $('#sample-table-2').dataTable({
                                    "aoColumns": [
                                        {"bSortable": true},
                                        {"bSortable": false},
                                        {"bSortable": false},
                                        {"bSortable": false},
                                        {"bSortable": false}
                                    ],
                                    "aaData": aaData
                                });
                            }
                            ;
        </script>
    </body>
</html>
